//
//  BClass.m
//  2Notification1
//
//  Created by zhengwei on 2/4/16.
//  Copyright © 2016 zhengwei. All rights reserved.
//

#import "BClass.h"
// A->B
@implementation BClass
-(void)testNotification{
    
//  参数1:谁在接收这个方法 参数2:响应方法 参数3:广播的名称 参数4:nil
//  self : 当前的这个类
//    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(testAction) name:@"TESTNOTIF" object:nil];
//    AClass *classa = [[AClass alloc]init];
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(testAction:) name:@"TESTNOTIF" object:nil];
    AClass *classa = [[AClass alloc]init];

}
-(void)testAction{
    NSLog(@"我已经接收到广播了");
}
-(void)testAction:(NSNotification*)notif{
    NSNumber *num = notif.object;
    NSDictionary *dic = notif.userInfo;
    NSLog(@"%@ %@",num,dic);
}
// 销毁
-(void)dealloc{
    [[NSNotificationCenter defaultCenter]removeObserver:self name:@"TESTNOTIF" object:nil];
}
@end
